//-------------------------------------------------------------------
//	Copyright (c) 2010-2014  Zhirnov Andrey
//	This file is part of the "UX Standard Lib" project.
//	See copyright notice in "UX_STL_Core.h".
//-------------------------------------------------------------------

#ifndef _UXS_RANDOM_ENGINE_H
#define _UXS_RANDOM_ENGINE_H

#pragma once

#include "Mathematics.h"
#include "../../OS/OSLowLevel.h"

namespace UX_STL
{
namespace UXMath
{

	
	//
	// Default C Random Engne
	//
	
	struct DefaultRandomEngine
	{
		uint operator () ()	const	{ return _hidden_::rand(); }
		uint Max()			const	{ return _hidden_::RAND_MAX; }
	};



	//
	// Platfomr Random Engine
	//

	struct PlatformRandomEngine
	{
	// variables
	private:
		PlatformRandomDevice	_device;

	// methods
	public:
		PlatformRandomEngine () : _device( uni_c_string() )
		{}
		
		uint operator () ()	const	{ uint result;  _device.Generate( result );  return result; }
		uint Max()			const	{ return MaxValue< uint >(); }
	};


	/*
#ifdef PLATFORM_WINDOWS
	template <uint MAX = 0xffff>
	struct TRandomEngineTicks
	{
		uint operator () ()	const	{ return ::GetTickCount() & MAX; }
		uint Max()			const	{ return MAX; }
	};
#endif
	*/


}	// UXMath
}	// UX_STL

#endif	// _UXS_RANDOM_ENGINE_H